package com.bittech.wiki_learn.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: yuisama
 * @Date: 2021/9/15 10:35
 * @Description:
 */
@RestController
public class TestController {
    // 带默认值的读取配置文件中字段
    @Value("${test.name:TEST}")
    private String testName;
    // 默认RequestMapping支持所有请求，若需指定请求类型，可以添加method字段
    @RequestMapping(value = "/hello",method = RequestMethod.GET)
    public String hello() {
        return "hello world:" + testName;
    }

    @RequestMapping(value = "/hello/post",method = RequestMethod.POST)
    public String helloPost(String name) {
        return "testPost:name = " + name;
    }
}
